import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FollowTypeVO, FollowTypeForm, FollowTypeQuery } from '@/api/goods/followType/types';

/**
 * 查询跟单类型列表
 * @param query
 * @returns {*}
 */

export const listFollowType = (query?: FollowTypeQuery): AxiosPromise<FollowTypeVO[]> => {
  return request({
    url: '/order/followType/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询跟单类型详细
 * @param id
 */
export const getFollowType = (id: string | number): AxiosPromise<FollowTypeVO> => {
  return request({
    url: '/order/followType/' + id,
    method: 'get'
  });
};


/**
 * 新增跟单类型
 * @param data
 */
export const addFollowType = (data: FollowTypeForm) => {
  return request({
    url: '/order/followType',
    method: 'post',
    data: data
  });
};

/**
 * 修改跟单类型
 * @param data
 */
export const updateFollowType = (data: FollowTypeForm) => {
  return request({
    url: '/order/followType',
    method: 'put',
    data: data
  });
};

/**
 * 删除跟单类型
 * @param id
 */
export const delFollowType = (id: string | number | Array<string | number>) => {
  return request({
    url: '/order/followType/' + id,
    method: 'delete'
  });
};
